'\" te
.\" Copyright (c) 2001, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH ACLTOMODE 3SEC "Dec 10, 2001"
.SH NAME
acltomode, aclfrommode \- convert an ACL to or from permission bits
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsec\fR [ \fIlibrary\fR... ]
#include <sys/types.h>
#include <sys/acl.h>



\fBint\fR \fBacltomode\fR(\fBaclent_t *\fR\fIaclbufp\fR, \fBint\fR \fInentries\fR, \fBmode_t *\fR\fImodep\fR);
.fi

.LP
.nf
\fBint\fR \fBaclfrommode\fR(\fBaclent_t *\fR\fIaclbufp\fR, \fBint\fR \fInentries\fR, \fBmode_t *\fR\fImodep\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBacltomode()\fR function converts an \fBACL\fR pointed to by
\fIaclbufp\fR into the permission bits buffer pointed to by \fImodep\fR. If the
\fBUSER_OBJ\fR \fBACL\fR entry, \fBGROUP_OBJ\fR \fBACL\fR entry, or the
\fBOTHER_OBJ\fR \fBACL\fR entry cannot be found in  the \fBACL\fR buffer, then
the function fails with \fBerrno\fR set to \fBEINVAL\fR.
.sp
.LP
The \fBUSER_OBJ\fR \fBACL\fR entry permission bits are copied to the file owner
class bits in the permission bits buffer. The \fBOTHER_OBJ\fR \fBACL\fR entry
permission bits are copied to the file other class bits in the permission bits
buffer. If there is a \fBCLASS_OBJ\fR (\fBACL\fR mask) entry, the
\fBCLASS_OBJ\fR \fBACL\fR entry permission bits are copied to the file group
class bits in the permission bits buffer. Otherwise, the \fBGROUP_OBJ\fR
\fBACL\fR entry permission bits are copied to the file group class bits in the
permission bits buffer.
.sp
.LP
The \fBaclfrommode()\fR function converts the permission bits pointed to by
\fImodep\fR into an ACL pointed to by \fIaclbufp\fR. If the \fBUSER_OBJ\fR
\fBACL\fR entry, \fBGROUP_OBJ\fR ACL entry, or the \fBOTHER_OBJ\fR ACL entry
cannot be found in the \fBACL\fR buffer, the function fails with  \fBerrno\fR
set to \fBEINVAL\fR.
.sp
.LP
The file owner class bits from the permission bits buffer are copied to the
\fBUSER_OBJ\fR \fBACL\fR entry. The file other class bits from the permission
bits buffer are copied to  the \fBOTHER_OBJ\fR \fBACL\fR entry. If there is a
\fBCLASS_OBJ\fR (\fBACL\fR mask) entry, the file group class bits from the
permission bits buffer are copied to the \fBCLASS_OBJ\fR \fBACL\fR entry, and
the \fBGROUP_OBJ\fR \fBACL\fR entry is not modified. Otherwise, the file group
class bits from the permission bits buffer are copied to the \fBGROUP_OBJ\fR
\fBACL\fR entry.
.sp
.LP
The \fInentries\fR argument represents the number of \fBACL\fR entries in the
buffer pointed to by \fIaclbufp\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the function returns \fB0\fR. Otherwise, it returns
\fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability 	Evolving
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.sp
.LP
.BR acl (2),
.BR attributes (7)
